import Vue from 'vue'
import App from './App.vue'
import WebAppSDK from '../core/sdk-core'
import { jsBridgeFactory } from '../adapter/jsbridge-factory'
import {LocalApiAdapter} from '../adapter/local-api-adapter'
(function fixLightAppAlert() {
  const api = window.lightAppJssdk?.notification
  if (!api) return

  // const rawAlert = api.alert
  api.alert = function (option = {}) {
    // 把递归调用换成系统弹窗
    window.alert(option.message )
  }
})()
jsBridgeFactory.registerAdapter('local_api', new LocalApiAdapter(window.lightAppJssdk))
// jsBridgeFactory.registerAdapter('app2', App2Adapter)
console.log("jdk",window);
console.log("jdk2",window.lightAppJssdk);
// console.log("jdk2",ZWJSBridge);

const sdkReady = WebAppSDK.create({
  appId: 'config-dev.json',
  // appId: 'config-prod.json',
  debug: process.env.NODE_ENV !== 'production'
})
sdkReady.then(sdk => {
  Vue.prototype.$sdk = sdk          // 现在一定是有值的实例
  Vue.config.productionTip = false
  new Vue({
    render: h => h(App)
  }).$mount('#app')
})